package org.sk.gsync.app.mybatis;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

public class FolderService {

    @Autowired
    @Qualifier("folderMapper")
    private FolderMapper folderMapper;

    public void addNewFolder(final String path) {
        Folder folder = new Folder();
        folder.setPath(path);
        folderMapper.insert(folder);
    }

    public List<Folder> getFolders() {
        return folderMapper.getAll();
    }

    public boolean exists(final Folder folder) {
        return (folderMapper.exists(folder.getPath())) == 1;
    }
}
